1
2
3
4
5
6
7 package ca.uhn.cache;
8
9 import java.util.Date;
10
11 /***
12 * TODO: this should extend IDataSource, not ISemanticCache.
13 *
14 * An extension of <code>ISemanticCache</code> that allows a caller to express
15 * that queries to a certain data scope are likely in the near future. This allows
16 * the cache to (optionally) retrieve this information in advance.
17 *
18 * @author <a href="mailto:bryan.tripp@uhn.on.ca">Bryan Tripp</a>
19 * @version $Revision: 1.1 $ updated on $Date: 2005/01/24 22:52:08 $ by $Author: bryan_tripp $
20 */
21 public interface IPreFetchingCache extends ISemanticCache {
22
23 /***
24 * Indicates that queries within the specified data scope are likely in the
25 * near future.
26 *
27 * @param theScope defines the scope of anticipated queries
28 *
29 * @param theEffectiveTime the time at which such queries may begin
30 *
31 * @param theExpiryTime the time at which such queries are likely to be finished
32 *
33 * @param theContextId a unique identifier for the caller or context, so that
34 * calls to disclaimInterest() can be related to calls to this method (for
35 * example if two users claim an interest in the same data we don't want to
36 * remove the data from cache until they both disclaim their interest).
37 *
38 * @precondition theScope != null
39 * @precondition theEffectiveTime != null
40 * @precondition theContextId != null
41 * @precondition CollectionUtils.select( Arrays.asList( theScope ), NotNullPredicate.INSTANCE ).isEmpty()
42 */
43 public void claimInterest(IQuery theScope, Date theEffectiveTime,
44 Date theExpiryTime, String theContextId);
45
46 /***
47 * Explicitly indicates that a previously claimed interest in some scope of data
48 * is at an end.
49 *
50 * @param theEffectiveTime the time at which the interest is to expire
51 *
52 * @param theContextId a unique identifier that was provided in a corresponding call
53 * to claimInterest()
54 *
55 * @precondition theEffectiveTime != null
56 * @precondition theContextId != null
57 */
58 public void disclaimInterest(Date theEffectiveTime, String theContextId);
59
60 }